import request from '@/utils/request'

export function loginApi(data) {
  return request({
    url: 'user/login',
    method: 'post',
    data
  })
}

export function userInfoApi() {
  return request.get('user/userInfo')
}

export function modifyUserApi(data) {
  return request({
    url: '/user/modify',
    method: 'put',
    data
  })
}

// 获取用户电话、昵称、头像
export function getUserDetailsApi(id) {
  return request.get(`/user/userDetails/${id}`)
}

// 注册用户
export function registerApi(data) {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}

// 上传头像
export function uploadAvatarApi(data) {
  return request({
    url: '/user/modifyAvatar',
    method: 'post',
    data
  })
}
